package com.newway.back.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.newway.back.entity.Dict;
import com.newway.back.mapper.DictMapper;
import com.newway.common.result.Result;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/system/dict")
public class DictController {

    @Resource
    DictMapper dictMapper;

    @GetMapping("/getDict")
    public Result getDict(){
        QueryWrapper<Dict> dictQueryWrapper = new QueryWrapper<>();
        dictQueryWrapper.eq("dict_type","distance");
        Dict dict = dictMapper.selectOne(dictQueryWrapper);
        return Result.success(dict);
    }

    @PostMapping("/update")
    public Result update(@RequestBody Dict dict){
        dictMapper.updateById(dict);
        return Result.success();
    }
}
